/*
 * @Author: 橘子
 * @Date: 2023-03-14 14:19
 * @Project_description: 按钮权限
 * @Description: 代码是我抄的，不会也是真的
 */

'use strict'
import cookies from '@/libs/util.cookies'

export default {
  methods: {
    /**
     * @desc:  按钮权限
     * @param {string} value 按钮list或者string
     * @return {boolean}
     * @Author: 橘子
     */
    _auth(value) {
      const uuid = cookies.get('uuid')
      const isAdmin = uuid === 'admin' || uuid === 'admin0'
      //将超管判断和普通用户判断分开处理
      if (isAdmin) {
        return true
      }
      const roles = this.$route.meta.roles || []
      const userRoles = new Set(roles)
      return userRoles.has(value)
    },
  },

}
